package com.zeroxml.cms.web.action.admin;

import com.zeroxml.cms.bo.SiteConfig;
import com.zeroxml.cms.web.action.BaseAdminAction;
import com.zeroxml.cms.service.ISiteConfigService;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.integration.spring.SpringBean;

/**
 * User: cjp
 * Date: 2007-9-20
 * Time: 12:19:27
 */
@UrlBinding("/admin/siteConfigManage.do")
public class SiteConfigManageAction extends BaseAdminAction {
    private SiteConfig siteConfig;
    @SpringBean
    private ISiteConfigService siteConfigService;

    public void setSiteConfigService(ISiteConfigService siteConfigService) {
        this.siteConfigService = siteConfigService;
    }

    public SiteConfig getSiteConfig() {
        return siteConfig;
    }

    public void setSiteConfig(SiteConfig siteConfig) {
        this.siteConfig = siteConfig;
    }

    @DefaultHandler
    public Resolution viewAllSiteConfig() {
        return getAdminResolution("siteConfigForm");
    }

    public Resolution refreshSiteConfig() {
        siteConfigService.refreshSiteConfig(siteConfig);
        return viewAllSiteConfig();
    }
}
